home *** CD-ROM | disk | FTP | other *** search
- Path: perception.co.nz!simond
- From: simond@perception.co.nz (Simon Dawson)
- Newsgroups: comp.lang.c
- Subject: Malloc failing with Huge Arrays under VC++ 1.0
- Message-ID: <pXsAxAWLBh107h@perception.co.nz>
- Date: Mon, 22 Jan 96 12:02:01 +1300
- Organization: Perception
-
- Hi All,
-
- ok, panic time here, trying to get huge arrays working under VC++, code works
- something like this (2 major arrays):
-
- ------------------------------------------
-
- //declare position as a huge global array
- unsigned long __huge *position;
-
-
- void main(void)
- {
-
- [snip other minor (nothing big) declarations]
-
-
- //set the maximum numbers we can deal with
- unsigned long MAX_ARRAY_SIZE = 16383;
-
- //malloc the position array - yes, unsigned long is same size as regular long!
- if (!(position = (unsigned long __huge *)malloc(MAX_ARRAY_SIZE * sizeof(unsigned long))) ) return;
-
- //define and malloc the stored values array
- float __huge *array;
- if (!(array = (float __huge *)malloc(MAX_ARRAY_SIZE * sizeof(float))) ) return;
-
-
- [snip code]
-
- }
-
-
- The code fails (drops out) when it goes to malloc the position array.
-
- ------------------------------------------
-
- The Compiler Options are:
-
- /nologo /f- /G3 /FPc /Mq /W3 /Zi /AH /Od /D "_DEBUG" /FR /Fd"SORT.PDB"
-
- The Linker Options are:
- /NOLOGO /LIB:"oldnames" /LIB:"libw" /LIB:"llibcewq" /NOD /NOE /PACKC:57344
- /STACK:16383 /ALIGN:16 /ONERROR:NOEXE /CO
-
- There is no .DEF file, but the stack forces through at 8096 bytes.
-
- ------------------------------------------
-
- I've read the __huge help file till I'm blue, plus the malloc, __far and anything
- else I can think of, but nothing seems to point to anything useful. I'm running
- WFW 3.11, on a 486-50, with 20Meg RAM, (40+ with swap), it's a clean start into
- windows, with no other apps in the background.
-
- So far I can get it to MAX_ARRAY_SIZE just over 10000, but we're not looking at
- a useful huge array at that stage.. as soon as I move to this size, it starts
- junking. I'd -like- to be able to run with a 100,000+ size set of arrays.
-
- Now it -used- to malloc fine, and then when I went to access later positions in
- the array array (eg, just loop through and set each position to 5 - as a test), it
- would GPF on me. Error message, no debug info, VC++ still running. No idea what
- has changed, but either way, situation seems to be getting worse.
-
-
-
- Does anyone have any suggestions that could point me in the right direction to
- actually be able to -use- these huge arrays? If you have anything I could try,
- that would be wonderful..
-
-
- Thankyou so much,
-
- Simon
-